/* 基础样式 */
:root {
    --primary-color: #f8f0e3;
    --secondary-color: #eadbc8;
    --accent-color: #e76f51;
    --accent-hover: #f4a261;
    --text-color: #433520;
    --bg-color: #faf6f0;
    --card-bg: #ffffff;
    --lighter-bg: #f5efe6;
    --border-color: #ddd0c0;
    --success-color: #6b9080;
    --warning-color: #e9c46a;
    --danger-color: #e63946;
    --text-muted: #8b7355;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* 侧边栏样式 */
.sidebar-container {
    position: fixed;
    left: 0;
    top: 0;
    width: 320px;
    height: 100vh;
    background-color: var(--primary-color);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 8px var(--shadow-color);
}

.sidebar-container.hide-sidebar {
    transform: translateX(-100%);
}

.sidebar {
    padding: 20px;
    height: 100%;
    overflow-y: auto;
}

.img-cycle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 24px;
    margin-bottom: 10px;
    border: 2px solid var(--accent-color);
    box-shadow: 0 2px 4px var(--shadow-color);
}

.separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 20px 0;
}

/* 统计面板 */
.stats-panel {
    background-color: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.stats-panel h3 {
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 16px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 14px;
}

.stat-value {
    color: var(--accent-color);
    font-weight: bold;
}

/* 筛选面板 */
.filter-panel {
    background-color: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 6px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.filter-panel h3 {
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 16px;
}

.filter-group {
    margin-bottom: 12px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 14px;
}

.filter-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 14px;
}

/* 气泡按钮 */
.bubble {
    position: fixed;
    right: 20px;
    top: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    z-index: 1001;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.bubble:hover {
    background-color: var(--accent-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 12px var(--shadow-color);
}

/* 主容器 */
.container {
    margin-left: 320px;
    padding: 20px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar-container.hide-sidebar ~ .container {
    margin-left: 0;
}

/* 顶部操作栏 */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.search-section {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 500px;
}

.search-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.action-section {
    display: flex;
    gap: 10px;
}

/* 按钮样式 */
.btn-primary, .btn-secondary, .btn-success {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 111, 81, 0.3);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--lighter-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #5a7c6f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 144, 128, 0.3);
}

/* 书籍网格 */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.book-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--shadow-color);
}

.book-cover {
    width: 100%;
    height: 200px;
    background-color: var(--lighter-bg);
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-cover.no-image {
    color: var(--text-muted);
    font-size: 48px;
}

.book-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 10px;
}

.book-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 10px;
}

.status-unstart {
    background-color: var(--text-muted);
    color: var(--card-bg);
}

.status-reading {
    background-color: var(--warning-color);
    color: var(--text-color);
}

.status-finished {
    background-color: var(--success-color);
    color: white;
}

.status-paused {
    background-color: var(--secondary-color);
    color: var(--text-color);
}

.book-progress {
    margin-bottom: 10px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: var(--lighter-bg);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-hover));
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

.book-rating {
    color: var(--warning-color);
    font-size: 14px;
}

/* 书籍卡片操作按钮 */
.book-actions {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.book-card:hover .book-actions {
    opacity: 1;
}

.btn-action {
    padding: 5px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    background-color: var(--secondary-color);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow-color);
}

.btn-edit:hover {
    background-color: var(--warning-color);
    color: white;
}

.btn-delete:hover {
    background-color: var(--danger-color);
    color: white;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--text-color);
}

.empty-state p {
    margin-bottom: 30px;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hide {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--primary-color);
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: var(--text-color);
    background-color: var(--secondary-color);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background-color: var(--lighter-bg);
    border-radius: 0 0 12px 12px;
}

/* 表单样式 */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color);
    font-weight: 500;
}

/* 编辑内容容器 */
.edit-content-container {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-color);
}

.edit-content-container textarea {
    border: none;
    border-radius: 0;
    resize: vertical;
    min-height: 120px;
    background: transparent;
    margin: 0;
}

.edit-content-container textarea:focus {
    border: none;
    box-shadow: none;
}

.markdown-preview {
    display: none;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    min-height: 120px;
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.markdown-preview:empty {
    display: none;
}

.markdown-preview p {
    margin: 0 0 10px 0;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
    margin: 15px 0 10px 0;
    color: var(--primary-color);
}

.markdown-preview ul,
.markdown-preview ol {
    margin: 10px 0 10px 20px;
}

.markdown-preview li {
    margin: 5px 0;
}

.markdown-preview code {
    background: var(--secondary-color);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-preview pre {
    background: var(--secondary-color);
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 10px 0;
}

.markdown-preview pre code {
    background: transparent;
    padding: 0;
}

.markdown-preview blockquote {
    margin: 10px 0;
    padding-left: 15px;
    border-left: 3px solid var(--primary-color);
    color: var(--text-muted);
    font-style: italic;
}

.markdown-preview strong {
    font-weight: bold;
    color: var(--text-color);
}

.markdown-preview em {
    font-style: italic;
}

.markdown-preview hr {
    border: none;
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

.edit-controls {
    padding: 10px 12px;
    background: var(--lighter-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-toggle {
    padding: 6px 12px;
    background: var(--primary-color);
    color: var(--text-color);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.btn-toggle:hover {
    background: var(--secondary-color);
}

.edit-controls .markdown-tip {
    font-size: 11px;
    color: var(--text-muted);
    flex: 1;
    text-align: right;
    line-height: 1.4;
    word-wrap: break-word;
}

.edit-controls .markdown-tip code {
    background: var(--secondary-color);
    padding: 1px 3px;
    border-radius: 2px;
    font-size: 10px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .edit-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .edit-controls .markdown-tip {
        text-align: left;
        font-size: 10px;
    }
    
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 10px;
    }
    
    .edit-content-container textarea {
        min-height: 100px;
    }
    
    .markdown-preview {
        min-height: 100px;
    }
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-bg);
    color: var(--text-color);
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* 导入预览 */
.import-preview {
    margin-top: 15px;
    padding: 15px;
    background-color: var(--lighter-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.import-preview h4 {
    margin-bottom: 10px;
    color: var(--text-color);
}

/* Toast样式 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
}

.toast {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px var(--shadow-color);
    animation: slideIn 0.3s ease forwards;
    position: relative;
    max-width: 300px;
}

.toast.success { 
    border-left: 4px solid var(--success-color);
}
.toast.warning { 
    border-left: 4px solid var(--warning-color);
}
.toast.error { 
    border-left: 4px solid var(--danger-color);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 通用工具类 */
.hide {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar-container {
        width: 280px;
    }
    
    .container {
        margin-left: 0;
        padding: 15px;
        padding-bottom: 80px; /* 为底部导航留出空间 */
    }
    
    .top-bar {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-section {
        width: 100%;
    }
    
    .action-section {
        width: 100%;
        justify-content: center;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* 模态框表单优化 */
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* 防止iOS自动缩放 */
        padding: 15px 12px; /* 增加触摸区域 */
        box-sizing: border-box;
    }
    
    .form-group textarea {
        min-height: 120px; /* 增加文本区域高度 */
        resize: vertical;
    }
    
    /* 按钮优化 */
    .btn-primary, .btn-secondary, .btn-success {
        min-height: 44px; /* iOS推荐的最小触摸区域 */
        font-size: 16px;
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .books-grid {
        grid-template-columns: 1fr;
    }
    
    .book-card {
        padding: 15px;
    }
    
    .book-cover {
        height: 150px;
    }
    
    /* 进一步优化小屏幕 */
    .modal-content {
        width: 98%;
        margin: 2% auto;
        padding: 15px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px;
        padding: 15px;
        border-radius: 8px;
        border-width: 2px;
    }
    
    .form-group textarea {
        min-height: 150px;
    }
    
    /* 模态框头部和底部优化 */
    .modal-header {
        padding: 15px 0;
        margin-bottom: 20px;
    }
    
    .modal-footer {
        padding: 20px 0 0;
        gap: 15px;
        flex-direction: column;
    }
    
    .modal-footer .btn-primary,
    .modal-footer .btn-secondary {
        width: 100%;
        margin: 0;
    }
    
    /* 确保输入框在视口内完全可见 */
    .form-group input:focus,
    .form-group textarea:focus {
        transform: translateZ(0); /* 强制硬件加速 */
    }
} 
/* 智能助手悬浮按钮 */
.assistant-floating-btn {
    position: fixed;
    right: 30px;
    bottom: 140px;
    background: linear-gradient(45deg, #00d4aa, #a1c4fd);
    color: white;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 15px rgba(0, 212, 170, 0.3);
    transition: all 0.3s ease;
    text-decoration: none;
    z-index: 999;
}

.assistant-floating-btn:hover {
    transform: scale(1.15) translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 212, 170, 0.4);
    background: linear-gradient(45deg, #00e6c0, #b1d1ff);
    text-decoration: none;
    color: white;
}

.assistant-floating-btn i {
    animation: assistantPulse 2s infinite;
}

@keyframes assistantPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@media (max-width: 1024px) {
    .assistant-floating-btn {
        right: 20px;
        bottom: 140px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .assistant-floating-btn {
        right: 15px;
        bottom: 130px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

@media (max-width: 360px) {
    .assistant-floating-btn {
        right: 15px;
        bottom: 120px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}
